home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / bprof-1.1 / bprof-1 / bprof / String.defs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-19  |  1.8 KB  |  61 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2. /* 
  3. Copyright (C) 1988 Free Software Foundation
  4.     written by Doug Lea (dl@rocky.oswego.edu)
  5.  
  6. This file is part of the GNU C++ Library.  This library is free
  7. software; you can redistribute it and/or modify it under the terms of
  8. the GNU Library General Public License as published by the Free
  9. Software Foundation; either version 2 of the License, or (at your
  10. option) any later version.  This library is distributed in the hope
  11. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  12. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13. PURPOSE.  See the GNU Library General Public License for more details.
  14. You should have received a copy of the GNU Library General Public
  15. License along with this library; if not, write to the Free Software
  16. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18.  
  19.  
  20. #ifndef _Stringdefs_h
  21. #define _Stringdefs_h 1
  22.  
  23. #include <String.h>        // Lines added by BdB
  24. #include <builtin.h>
  25. #define StringHASH(x) (hashpjw(x))
  26.  
  27. // equality operator
  28. #ifndef StringEQ
  29. #define StringEQ(a, b)  ((a) == (b))
  30. #endif
  31.  
  32. // less-than-or-equal
  33. #ifndef StringLE
  34. #define StringLE(a, b)  ((a) <= (b))
  35. #endif
  36.  
  37. // comparison : less-than -> < 0; equal -> 0; greater-than -> > 0
  38. #ifndef StringCMP
  39. #define StringCMP(a, b) ( ((a) <= (b))? (((a) == (b))? 0 : -1) : 1 )
  40. #endif
  41.  
  42. // hash function
  43. #ifndef StringHASH
  44. extern unsigned int hash(String&);
  45. #define StringHASH(x)  hash(x)
  46. #endif
  47.  
  48. // initial capacity for structures requiring one
  49.  
  50. #ifndef DEFAULT_INITIAL_CAPACITY
  51. #define DEFAULT_INITIAL_CAPACITY 100
  52. #endif
  53.  
  54. // HASHTABLE_TOO_CROWDED(COUNT, SIZE) is true iff a hash table with COUNT
  55. // elements and SIZE slots is too full, and should be resized.
  56. // This is so if available space is less than 1/8.
  57.  
  58. #define HASHTABLE_TOO_CROWDED(COUNT, SIZE) ((SIZE) - ((SIZE) >> 3) <= (COUNT))
  59.  
  60. #endif
  61.